#pragma once
#include<iostream>
#include<pthread.h>
#include<queue>

namespace MutexModule
{
    class Mutex
    {
    public:
        Mutex()
        {
            pthread_mutex_init(&_mutex,nullptr);
        }
        void Lock()
        {
            int n=pthread_mutex_lock(&_mutex);
            (void)n;
        }
        void Unlock()
        {
            int n=pthread_mutex_unlock(&_mutex);
            (void)n;
        }

        pthread_mutex_t* Get()
        {
            return &_mutex;
        }
        ~Mutex()
        {
            pthread_mutex_destroy(&_mutex);
        }
    private:
        pthread_mutex_t _mutex;
    
    };

    class LockGuard
    {
    public:
        LockGuard(Mutex &mutex):_mutex(mutex)
        {
            _mutex.Lock();
        }
        ~LockGuard()
        {
            _mutex.Unlock();
        }
    private:
        Mutex &_mutex;
    };
}

/*
    writer  by xs
    _____________                                                                   
    <  wu wang  >
    -------------                                                                 
       \ 
        \                                                                      
                                      .::!!!!!!!:.
     .!!!!:.                         .:!!!!!!!!!!!!                                 
     ~~~~!!!!!!.                 .:!!!!!!!!LINUX$$$
         :$$XSX!!:           .:!!!!!!!!!!XUSE$$$$$Z
         $$$$$##XS!:      .<!!!!XS$$$$"  $$$$$$$$#
         $$$$$   $$HQ   :!!XS$$$$$$$$$   4$$$$$*
         ^$$$$   $$$\     $$$$$$$$$$$$   W$$WR"
           ""$bd$$$$      .*$$$$$$$$$$MUDUO"
                """"          """""
                    

*/